package com.million.service;

import com.million.base.EvictionStrategyAnnotationParseFactory;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 * @Author miki
 * @Date 2022/1/22 1:56
 * @Explain 提供策略调用
 */
@Slf4j
@Service
public class EvictionStrategyService {

    private static final Logger logger = LoggerFactory.getLogger(EvictionStrategyService.class);

    @Autowired
    EvictionStrategyAnnotationParseFactory evictionStrategyAnnotationParseFactory;

    public EvictionStrategy select(String eviction) {
        logger.info("eviction param value is {}", eviction);
        return evictionStrategyAnnotationParseFactory.getEviction(eviction.toUpperCase());
    }
}
